<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增视频管理')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-video-add">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">视频简介：</label>
                    <div class="col-sm-8">
                        <input name="vName" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">视频id：</label>
                    <div class="col-sm-8">
                        <input name="vId" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">视频时长：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="vDuration" class="form-control" placeholder="HH:mm:ss" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">视频封面：</label>
                    <div class="col-sm-8">
                        <input type="hidden" name="vCover">
                        <div class="file-loading">
                            <input class="form-control file-upload" id="vCover" name="file" type="file">
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">视频类型：</label>
                    <div class="col-sm-8">
                        <select name="vType" class="form-control" th:with="type=${@dict.getType('type_id')}" required>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">视频发布日期：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="creatTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">视频点击次数：</label>
                    <div class="col-sm-8">
                        <input name="vNum" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">视频创建者：</label>
                    <div class="col-sm-8">
                        <input name="vCreator" class="form-control" type="text" required>
                    </div>
                </div>
            </div><div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">视频文件：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="vIp">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="vIp" name="file" type="file">
                    </div>
                </div>
            </div>
        </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "system/video"
        $("#form-video-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-video-add').serialize());
            }
        }

        $("input[name='vDuration']").datetimepicker({
            format: "HH:mm:ss",
            minView: "day",
            autoclose: true
        });

        $("input[name='creatTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(".file-upload").fileinput({
            uploadUrl: ctx + 'common/upload',
            maxFileCount: 1,
            autoReplace: true
        }).on('fileuploaded', function (event, data, previewId, index) {
            $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')
        })
    </script>
</body>
</html>